Stropping (syntax)

When applied to computer languages, stropping refers to the method used to mark letter sequences as having a special property such as being a keyword or certain type of variable or storage location.

The use of stropping allows the same letter sequence to be used both as a keyword and as an identifier, and more efficient lexical pre-pass before parsing, virtually eliminating the need for a complex lexer such as Lex.

Contents

Syntaxes

A range of different syntaxes for stropping have been used:

In fact it was often the case that several stropping conventions might be in use within the one language:

Examples of different ALGOL 68 styles

Algol68 as typically published
¢ bold or underline typeface ¢
mode xint = int;
xint sum sq:=0;
for i while
  sum sq≠70×70
do
  sum sq+:=i↑2
od 
Quote stropping (like wikitext)
'pr' quote 'pr' 
'mode' 'xint' = 'int';
'xint' sum sq:=0;
'for' i 'while'
  sum sq≠70×70
'do'
  sum sq+:=i↑2
'od'
For a 7-bit character code compiler
.PR UPPER .PR
MODE XINT = INT;
XINT sum sq:=0;
FOR i WHILE
  sum sq/=70*70
DO
  sum sq+:=i**2
OD 
For a 6-bit character code compiler
.PR POINT .PR
.MODE .XINT = .INT;
.XINT SUM SQ:=0;
.FOR I .WHILE
  SUM SQ .NE 70*70
.DO
  SUM SQ .PLUSAB I .UP 2
.OD
Algol68 using res stropping (reserved word)
.PR RES .PR
mode .xint = int;
.xint sum sq:=0;
for i while
  sum sq≠70×70
do
  sum sq+:=i↑2
od 

Modern languages

Most modern programming languages do not use stropping - although Ruby and Perl both use sigils to identify characteristics of variables/constants: Perl to designate the type of variable, Ruby to distinguish variables from constants and to indicate scope.

See also

References

  1. ^ http://www.fh-jena.de/~kleine/history/languages/Algol68-RR-HardwareRepresentation.pdf
  2. ^ van Wijngarten et al. (1976) Section 9.3
  3. ^ Lindsey and van der Meulen (1977) pp.348-349